



//
//  ShuoMingView.m
//  1243
//
//  Created by apple on 16/7/6.
//  Copyright © 2016年 1243. All rights reserved.
//

#import "ShuoMingView.h"

@implementation ShuoMingView
{
    UIScrollView        *backView;
}
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        backView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, self.frame.size.height)];
        backView.contentSize = CGSizeMake(WIDTH, HEIGHT );
        
        backView.backgroundColor = [UIColor whiteColor];
        
        [self addSubview:backView];
        [self creatLunbO];
        
        
    }
    return self;
}

- (void)creatLunbO{
    NSArray *image = @[
                       [UIImage imageNamed:@"bot_1"],
                       [UIImage imageNamed:@"banner_bot1_boom"],
                       [UIImage imageNamed:@"bot_2"],
                       [UIImage imageNamed:@"bot_3"]
                       ];
    UIScrollView *scorllView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 130)];
    scorllView.backgroundColor = [UIColor greenColor];
    [backView addSubview:scorllView];
    // 边缘弹动 效果 bounces
    scorllView.bounces = NO;
    // 整页翻动 pagingEnable
    scorllView.pagingEnabled = YES;
    // 允许滚动
    scorllView.scrollEnabled = YES;
    // 快速滚到当前页面顶端 (点击状态栏时) scrollToTop
    scorllView.scrollsToTop = YES;
    // 隐藏滚动条
    scorllView.showsHorizontalScrollIndicator = YES;  //横向
    scorllView.showsVerticalScrollIndicator = YES;   // 纵向s
    // 自定义滚动条样式
    scorllView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
    scorllView.contentSize = CGSizeMake(WIDTH * image.count, 130);
    
    for (NSInteger i = 0; i < image.count; i++) {
        UIImageView *a = [[UIImageView alloc] init];
        [scorllView addSubview:a];
        a.image = image[i];
        a.frame = CGRectMake(WIDTH *i, 0, WIDTH, 130);
    }
    
}

@end
